/*!
\copyright  Copyright (c) 2025 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\brief      Kymera implementation of Streaming Mode Manager audio interface
*/

#include "../streaming_mode_manager_audio_if.h"
#include "streaming_mode_manager_core.h"
#include "kymera.h"
#include "kymera_latency_manager.h"

#ifdef INCLUDE_LATENCY_MANAGER

static void streamingModeManagerAudio_MessageHandler(Task task, MessageId id, Message message);
static const TaskData task_data = {.handler = streamingModeManagerAudio_MessageHandler};
#define TASK ((Task)&task_data)

static void streamingModeManagerAudio_MessageHandler(Task task, MessageId id, Message message)
{
    UNUSED(task);
    switch(id)
    {
        case KYMERA_STREAM_MODIFIER_CHANGED_IND:
        {
            const KYMERA_STREAM_MODIFIER_CHANGED_IND_T *msg = message;
            StreamingModeManagerCore_QcmModeChanged(msg->modifier);
        }
        break;
        case KYMERA_LOW_LATENCY_STATE_CHANGED_IND:
        {
            const KYMERA_LOW_LATENCY_STATE_CHANGED_IND_T *msg = message;
            StreamingModeManagerCore_A2dpLlStateChanged(msg->state);
        }
        break;
        case KYMERA_HIGH_BANDWIDTH_STATE_CHANGED_IND:
        {
            const KYMERA_HIGH_BANDWIDTH_STATE_CHANGED_IND_T *msg = message;
            StreamingModeManagerCore_A2dpHbStateChanged(msg->state);
        }
        break;
        default:
        break;
    }
}

#endif // INCLUDE_LATENCY_MANAGER

void StreamingModeManagerAudio_Init(void)
{
#ifdef INCLUDE_LATENCY_MANAGER
    Kymera_ClientRegister(TASK);
#endif
}
